home *** CD-ROM | disk | FTP | other *** search
- ; FPRINT
- ; Benchmark to print to a file.
-
- (defvar test-atoms '(abcdef12 cdefgh23 efghij34 ghijkl45 ijklmn56 klmnop67
- mnopqr78 opqrst89 qrstuv90 stuvwx01 uvwxyz12
- wxyzab23 xyzabc34 123456ab 234567bc 345678cd
- 456789de 567890ef 678901fg 789012gh 890123hi))
-
- (defun fprint-init (m n atoms)
- (let ((atoms (copy-tree atoms)))
- (do ((a atoms (cdr a)))
- ((null (cdr a)) (rplacd a atoms)))
- (fprint-init1 m n atoms)))
-
- (defun fprint-init1 (m n atoms)
- (cond ((= m 0) (pop atoms))
- (t (do ((i n (- i 2))
- (a ()))
- ((< i 1) a)
- (push (pop atoms) a)
- (push (fprint-init1 (1- m) n atoms) a)))))
-
- (defvar test-pattern (fprint-init 6. 6. test-atoms))
-
- (defparameter fprint-test-file "FPRINT.TST")
-
- (defun fprint ()
- (let ((f (open fprint-test-file :direction :output)))
- (print test-pattern f)
- (close f)))
-
- (define-timer fprint "FPrint" (fprint))
-
- ; FREAD
- ; Benchmark to read from a file.
-
- (defun fread ()
- (let ((f (open fprint-test-file)))
- (read f)
- (close f)))
-
- (define-timer fread "FRead" (fread))
-
- ; TPRINT
- ; Benchmark to print and read to the terminal
-
- (defvar test-atoms '(abc1 cde2 efg3 ghi4 ijk5 klm6 mno7 opq8 qrs9
- stu0 uvw1 wxy2 xyz3 123a 234b 345c 456d
- 567d 678e 789f 890g))
-
- (defun tprint-init (m n atoms)
- (let ((atoms (copy-tree atoms)))
- (do ((a atoms (cdr a)))
- ((null (cdr a)) (rplacd a atoms)))
- (tprint-init1 m n atoms)))
-
- (defun tprint-init1 (m n atoms)
- (cond ((= m 0) (pop atoms))
- (t (do ((i n (- i 2))
- (a ()))
- ((< i 1) a)
- (push (pop atoms) a)
- (push (tprint-init1 (1- m) n atoms) a)))))
-
- (defvar test-pattern (tprint-init 6. 6. test-atoms))
-
- (define-timer tprint "TPrint" (print test-pattern))